import { memo } from "react";
import { checkboxColWidth } from "./const";
import { IColumn } from "./types";

const ColGroups = memo((props: {
  columns: IColumn[];
  /** 展示选中列 */
  showCheckbox?: boolean;
}) => {
  return (
    <colgroup>
      {
        props.showCheckbox ? (
          <col style={{width: checkboxColWidth}} />
        ) : null
      }
        {
          props.columns.map(col => {
            return <col style={{width: col.width  || 100}} key={col.key} />
          })
        }
      </colgroup>
  )
});

export {
  ColGroups
};

